

import 'package:beautiful_demo/common/res.dart';
import 'package:beautiful_demo/common/widget/button.dart';
import 'package:beautiful_demo/common/widget/login.dart';
import 'package:drive/drive.dart';

import 'controller.dart';
import 'package:flutter/material.dart';
import 'widget.dart';
import 'package:flutter_mvc/flutter_mvc.dart';

///description:登录
class LoginPage extends BasePage<LoginController> {
  @override
  Widget build(BuildContext context) {
    return SystemStateBar(
      child: Container(
        color: Colors.white,
        child: Stack(
          children: [
            Positioned.fill(
                child: Container(
              color: Colors.white,
            )),
            Positioned(
              right: -230.dp,
              top: -230.dp,
              child:
                  RadialWidget(460.dp, const [Colors.white, Color(0x33ff0000)]),
            ),
            Positioned(
              bottom: -150.dp,
              right: -150.dp,
              child:
                  RadialWidget(300.dp, const [Colors.white, Color(0x33ffb700)]),
            ),
            Positioned(
              bottom: -120.dp,
              left: -120.dp,
              child:
                  RadialWidget(220.dp, const [Colors.white, Color(0x27b4ff00)]),
            ),
            Positioned.fill(
                child: SafeArea(
              child: Container(
                padding: EdgeInsets.only(left: 30.dp),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    SizedBox(
                      height: 80.dp,
                    ),
                    Container(
                      width: 100.dp,
                      height: 100.dp,
                      alignment: Alignment.center,
                      decoration: BoxDecoration(
                          color: Colors.white,
                          borderRadius: BorderRadius.circular(8.dp),
                          boxShadow: const [
                            BoxShadow(color: Color(0x1f000000), blurRadius: 3)
                          ]),
                      child: Image.asset(
                        "images/Icons8logo.png",
                        width: 90.dp,
                        height: 90.dp,
                      ),
                    ),
                    SizedBox(
                      height: 15.dp,
                    ),
                    Text(
                      "beauty_demo",
                      style: resTextStyle30.copyWith(fontSize: 18.sp),
                    ),
                    SizedBox(
                      height: 40.dp,
                    ),
                    LoginEditWidget("手机号", "请输入账号", c.textPhoneController,keyType: TextInputType.phone,),
                    SizedBox(
                      height: 30.dp,
                    ),
                    LoginEditWidget("密码", "请输入密码", c.textPwdController,obscureText: true,),
                    SizedBox(
                      height: 60.dp,
                    ),
                    Row(
                      children: [
                        Expanded(
                          flex: 2,
                          child: DMainButton(
                            "登录",
                            null,
                            40.dp,
                            fontSize: 16.sp,
                            borderRadius: 30.dp,
                            onTap: c.onLoginClick,
                          ),
                        ),
                        SizedBox(
                          width: 40.dp,
                        ),
                        Expanded(
                            flex: 1,
                            child: Stack(
                              children: [
                                Container(
                                  margin:EdgeInsets.only(left: 50.dp),
                                  child: ClipPath(
                                    clipper: BackgroundPath(),
                                    child: Container(
                                      height: 100.dp,
                                      color: const Color(0xffff4444),
                                    ),
                                  ),
                                ),
                                Positioned.fill(
                                  child: Center(
                                      child: GestureDetector(
                                        onTap: c.onRegisterClick,
                                        child: Container(
                                          alignment: Alignment.center,
                                          decoration: BoxDecoration(
                                              color: const Color(0xffff4444),
                                              borderRadius: resBorderRadius(topLeft: 30.dp,bottomLeft: 30.dp)),
                                          height: 40.dp,
                                          child: Text(
                                            "注册",
                                            style: resTextStyle.copyWith(
                                                fontSize: 14.sp,
                                                color: Colors.white),
                                          ),
                                        ),
                                      )
                                  ),
                                )
                              ],
                            ))
                      ],
                    )
                  ],
                ),
              ),
            ))
          ],
        ),
      ),
    );
  }
}
